#pragma once

#include "LClientSocket.h"

class LFileDown :
	public LSocket
{
public:
	LFileDown(LClientSocket * connect);
	void ConnectServer(LPSTR ip, UINT port);
	void DownFile(HANDLE file, LPTSTR filepath,BOOL autoClose=FALSE);
	void DownFile(LPTSTR localPath, LPTSTR filePath);
	~LFileDown();
protected:
	virtual void RecvProgress(INT n) = 0;
private:
	BOOL Connect();
	void ConnectBack();
	void DisconnectBack();
	void RecvProgressCallBack(INT n);
	void RecvMsgCallBack(LBuffer * pBuffer);
private:
	LClientSocket * server;
	LPSTR m_pIp;
	UINT m_nPort;
	BOOL isConnect;
	HANDLE hEvent;
};

